<!-- Pagination Links-->
<div class="row">
    <div class="col">
        <p class="text-left mt-3 d-block">Showing page {{ pages.page }} of {{ pages.pages }}</p>
    </div>
    <div class="col text-right">
        <a href="{{ url_for(page_name, page=pages.prev_num) }}"
           class="btn btn-primary {% if pages.page == 1 %}disabled{% endif %}">&laquo;</a>
        <!-- Loop through the number of pages to display a link for each-->
        {% for page_num in pages.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
            {% if page_num %}
                <!-- Check for the active page and set the link to "Active"-->
                {% if pages.page == page_num %}
                    <a href="{{ url_for(page_name, page=page_num) }}"
                       class="btn btn-secondary active">{{ page_num }}</a>
                {% else %}
                    <a href="{{ url_for(page_name, page=page_num) }}"
                       class="btn btn-primary">{{ page_num }}</a>
                {% endif %}
            {% else %}
                ...
            {% endif %}
        {% endfor %}
        <a href="{{ url_for(page_name, page=pages.next_num) }}"
           class="btn btn-primary {% if pages.page == pages.pages %}disabled{% endif %}">&raquo;</a>
    </div>
</div>